/*
 * ResourceManager.h
 *
 *  Created on: Mar 24, 2010
 *      Author: dcrown
 */

#ifndef RESOURCEMANAGER_H_
#define RESOURCEMANAGER_H_

#include "MovePattern.h"
#include "..\GameObjects\Baddie.h"
#include <map>
#include <string>

using namespace std;

class ResourceManager
{

public:
	ResourceManager() {}
	virtual ~ResourceManager() {Clear();}

	void Clear() {}
	void Create() {}
	void Destroy();

	string OpenFile(string filename);
	void CloseFile(string fileId);
	Baddie* ReadBaddie(string fileId);
	int ReadBaddieHeader(string fileId);
	MovePattern* ReadMovePattern(ifstream* mpFile);

private:

	ifstream* GetIfStream(string fileId);

	//Utility Functions
	vector<string> SplitString(string line, char delim);
	bool ContainsOnlyDigits(vector<string> theStrings);
	bool IsValidFloat(vector<string> theStrings);
	bool IsValidFloat(string theString);
	bool IsValidInt(string theString);
	bool IsValidBool(vector<string> theStrings);
	bool IsValidBool(string theString);
	bool StartsWith(string theString, string startingMatch);
	bool StartsWith(string theString, char startingMatch);
	bool ContainsOnlyWhitespace(string theString);
	void ResourceManager::GetNextDataLine(ifstream* file, string& line);

	map<string, ifstream*> openFiles;
};

#endif /* RESOURCEMANAGER_H_ */
